﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace DemoGame1
{
    public class Enemy: Character
    {
        public int move = 0;
        public int getHP()
        {
            return HP;
        }
        public void Automove()
        {
            if (Status != WALK)
            {
                SetFrameSequence(WALK);
                Status = WALK;
            }
            if (move < 0)
            {
                move--;
                if (move < -10)
                {
                    move = 0;
                }
                this.SetTransform(SpriteEffects.None);
                adjustTopleft(TopLeft.X - SPEED, TopLeft.Y);


            }

            if (move > 0)
            {
                move++;
                if (move > 10)
                {
                    move = 0;
                }

                this.SetTransform(SpriteEffects.FlipHorizontally);
                adjustTopleft(TopLeft.X + SPEED, TopLeft.Y);


            }
            if (move == 0)
            {


                if (lastDirection == LEFT)
                {
                    move--;
                }
                else
                {
                    move++;
                }
                lastDirection = (LEFT + RIGHT) - lastDirection;
            }

        }
        public void InitEnemy(Vector2 _topleft, Vector2 _size)
        {
            TopLeft = _topleft;
            Size = _size;
            Sprites = new List<My2DSprite>();
            My2DSprite character = new My2DSprite(standSequence, TopLeft);
            Sprites.Add(character);
            nSprites = Sprites.Count;
        }
    }
}
